package com.jmu.aslongastoday.common;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@NoArgsConstructor
@AllArgsConstructor
@ApiModel(value = "返回类")
public class Result {

    @ApiModelProperty(value = "响应码")
    private String code;
    @ApiModelProperty(value = "信息")
    private String msg;
    @ApiModelProperty(value = "数据")
    private Object data;

    public static Result error(String code, String message) {
        return new Result(code, message, null);
    }

    public static Result success(Object object) {
        return new Result("200", "", object);
    }

    public static Result success(String message, Object object) {
        return new Result("200", message, object);
    }

    public static Result fail(String msg, Object o) {
        return new Result("-1", msg, o);
    }

    public static Result fail(String msg) {
        return new Result("-1", msg, null);
    }


}
